Skip to content

Add http_headers and http_path_prefix provider configuration options for HTTP proxy support - #5232

Open
cjoy wants to merge 2 commits into
databricks:mainfrom
cjoy:feature/http-proxy-configuration
Open

Add http_headers and http_path_prefix provider configuration options for HTTP proxy support#5232
cjoy wants to merge 2 commits into
databricks:mainfrom
cjoy:feature/http-proxy-configuration

Conversation

@cjoy

@cjoy cjoy commented Nov 27, 2025

Copy link
Copy Markdown

Added two new provider configuration options to support HTTP proxy scenarios where custom headers or URL path rewriting are required:

  • http_headers - A map of custom HTTP headers added to all API requests (marked as sensitive)
  • http_path_prefix - A path prefix prepended to all API request URLs

Changes:

  • Core Implementation (internal/providers/client/databricks_client.go):

    • Added HTTPConfig struct to hold custom headers and path prefix
    • Added httpTransportWrapper implementing http.RoundTripper that injects headers and prepends path prefix
    • Modified PrepareDatabricksClient to accept optional *HTTPConfig and configure HTTP transport
  • SDKv2 Provider (internal/providers/sdkv2/sdkv2.go):

    • Added http_headers schema field (TypeMap, optional, sensitive)
    • Added http_path_prefix schema field (TypeString, optional)
    • Updated ConfigureDatabricksClient to read and pass HTTP config
  • Plugin Framework Provider (internal/providers/pluginfw/pluginfw.go):

    • Added http_headers schema field (MapAttribute with StringType)
    • Added http_path_prefix schema field (StringAttribute)
    • Updated configureDatabricksClient to read and pass HTTP config
  • Unit Tests:

    • internal/providers/client/databricks_client_test.go: Tests for httpTransportWrapper RoundTrip behavior
    • internal/providers/sdkv2/sdkv2_test.go: Schema validation and configuration tests

Implementation Details:

  • Uses Go SDK's HTTPTransport field to inject a custom http.RoundTripper
  • Headers are set on each request via req.Header.Set()
  • Path prefix is prepended to req.URL.Path (trailing slashes are trimmed)
  • Both SDKv2 and Plugin Framework providers share the same underlying client configuration
  • http_headers is marked as sensitive to avoid logging credentials

Example Usage:

provider "databricks" {
  host  = "https://proxy.example.com"
  token = "your-token"

  http_headers = {
    "X-Custom-Auth" = "auth-value"
  }

  http_path_prefix = "/proxy"
}

Tests

  • make test runs locally (2615 tests pass)
  • relevant change in docs/ folder
  • unit tests for HTTP transport wrapper and schema
  • using Go SDK (config.HTTPTransport)
  • using TF Plugin Framework
  • has entry in NEXT_CHANGELOG.md file

@cjoy
cjoy requested review from a team as code owners November 27, 2025 07:22
@cjoy
cjoy requested review from rauchy and removed request for a team November 27, 2025 07:22
@alexott

alexott commented Nov 27, 2025

Copy link
Copy Markdown
Contributor

IMHO, it should be done in Go SDK and only then exposed to TF

@cjoy

cjoy commented Nov 27, 2025

Copy link
Copy Markdown
Author

IMHO, it should be done in Go SDK and only then exposed to TF

@alexott Fair point. I've raised a PR here: databricks/databricks-sdk-go#1340

@github-actions

Copy link
Copy Markdown
Contributor

If integration tests don't run automatically, an authorized user can run them manually by following the instructions below:

Trigger:
go/deco-tests-run/terraform

Inputs:

  • PR number: 5232
  • Commit SHA: 51b81181319d99e26edfc8ffb758f5aba38b4fd6

Checks will be approved automatically on success.

@github-actions

Copy link
Copy Markdown
Contributor

Marking this pull request as stale because it has been open for 180 days with no activity. This helps our maintainers find and focus on the active pull requests. If this pull request receives no comments or updates in the next 30 days it will automatically be closed. Maintainers can also remove the stale label.

If this pull request was automatically closed and you feel this pull request should be reopened, we encourage creating a new pull request linking back to this one for added context. Thank you!

@github-actions github-actions Bot added the stale label Jul 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants